<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">用户列表</div>
                </div>
                <div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom am-cf">
                        <form class="toolbar-form" action="{:url('food.user/index')}">
                            <div class="am-u-sm-12">
                                <div class="am fr">
                                    <div class="am-form-group am-fl">
                                        <select name="gender" data-am-selected="{btnSize: 'sm', placeholder: '性别不限'}">
                                            <option value="all" <?= $gender == 'all' ?'selected':''?>>全部</option>
                                            <option value="1" <?= $gender == '1' ?'selected':''?>>先生</option>
                                            <option value="2" <?= $gender == '2' ?'selected':''?>>女士</option>
                                            <option value="0" <?= $gender == '0' ?'selected':''?>>未知</option>
                                        </select>
                                    </div>
                                    <div class="am-form-group am-fl">
                                        <div class="am-input-group am-input-group-sm tpl-form-border-form">
                                            <input type="text" class="am-form-field" name="search" placeholder="请输入微信昵称、ID、手机号" value="{$search}">
                                            <div class="am-input-group-btn">
                                                <button class="am-btn am-btn-default am-icon-search" type="submit"></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>头像</th>
                                <th>昵称</th>
                                <th>性别</th>
                                <th>手机</th>
                                <th>消费</th>
								<th>余额</th>
                                <th>积分</th>
                                <th>省份</th>
                                <th>城市</th>
                                <th>平台</th>
								<th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if !$list->isEmpty()}
                                {foreach $list as $item}
                                <tr>
                                    <td class="am-text-middle">{$item['user_id']}</td>
                                    <td class="am-text-middle">
                                        <img src="{$item['avatar']}" width="72" height="72" alt="">
                                    </td>
                                    <td class="am-text-middle">{$item['nickname']|default='--'}</td>
                                    <td class="am-text-middle">{$item['gender']}</td>
                                    <td class="am-text-middle">{$item['phone']}</td>
                                    <td class="am-text-middle">{$item['pay']}</td>
									<td class="am-text-middle">{$item['money']}</td>
									<td class="am-text-middle">{$item['score']}</td>
                                    <td class="am-text-middle">{$item['province']|default='--'}</td>
                                    <td class="am-text-middle">{$item['city']|default='--'}</td>
                                    <td class="am-text-middle">{$item['platform']['text']}</td>
									<td class="am-text-middle">
										<div class="tpl-table-black-operation">
                                            <a class="j-recharge tpl-table-black-operation-default"
                                                href="javascript:void(0);"
                                                title="用户充值"
                                                data-id="{$item['user_id']}"
                                                data-balance="{$item['money']}"
                                                data-points="{$item['score']}">
												<i class="iconfont icon-qiandai"></i>充值
                                            </a>
											<!--
                                            <a class="j-del tpl-table-black-operation-default"
                                                href="javascript:void(0);"
                                                data-ids="<?= $item['user_id'] ?>" title="删除用户">
                                                <i class="am-icon-trash"></i>删除
                                            </a>
											
                                            <div class="j-opSelect operation-select am-dropdown">
                                                <button type="button" class="am-dropdown-toggle am-btn am-btn-sm am-btn-secondary">
                                                    <span>更多</span>
                                                    <span class="am-icon-caret-down"></span>
                                                </button>
                                                <ul class="am-dropdown-content" data-id="<?= $item['user_id'] ?>">
                                                    <li>
                                                        <a class="am-dropdown-item" target="_blank" 
															href="index.php?s=/store/order/all_list/user_id/<?= $item['user_id'] ?>">
															用户订单
														</a>
                                                    </li>
                                                    <li>
                                                        <a class="am-dropdown-item" target="_blank"
                                                            href="index.php?s=/store/user.recharge/order/user_id/<?= $item['user_id'] ?>">
															充值记录
														</a>
                                                    </li>
                                                    <li>
                                                        <a class="am-dropdown-item" target="_blank"
                                                            href="index.php?s=/store/user.balance/log/user_id/<?= $item['user_id'] ?>">
															余额明细
														</a>
                                                    </li>
                                                </ul>
                                            </div>
											-->
                                        </div>
									</td>
                                </tr>
                                {/foreach}
                            {else /}
                                <tr>
                                    <td colspan="12" class="am-text-center">暂无记录</td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr">{:$list->render()} </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：{:$list->total()}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="food/user/tpl/tp_recharge" /}
<script>
    $(function () {

        /**
         * 账户充值
         */
        $('.j-recharge').on('click', function () {
            var $tabs, data = $(this).data();
            $.showModal({
                title: '用户充值'
                , area: '460px'
                , content: template('tpl-recharge', data)
                , uCheck: true
                , success: function ($content) {
                    $tabs = $content.find('.j-tabs');
                    $tabs.tabs({noSwipe: 1});
                }
                , yes: function ($content) {
                    $content.find('form').myAjaxSubmit({
                        url: "{:url('food.user/recharge')}",
                        data: {
                            user_id: data.id,
                            source: $tabs.data('amui.tabs').activeIndex
                        }
                    });
                    return true;
                }
            });
        });

        $('#my-form').formPost();
		
    });

</script>